//
//  FirstPageFirstModel_Ht.m
//  WZLProduct
//
//  Created by dllo on 16/3/20.
//  Copyright © 2016年 HaiTeng. All rights reserved.
//

#import "FirstPageFirstModel_Ht.h"
#import "WHTFirstPageLBModel.h"
#import "WHTFirstPageStoryModel.h"
#import "WHTFirstPageTripModel.h"

@implementation FirstPageFirstModel_Ht

- (void)setValue:(id)value forUndefinedKey:(NSString *)key{
    
}

- (instancetype)init{
    self = [super init];
    if (self) {
        self.storyDataArray = [NSMutableArray array];
        self.tripDataArray = [NSMutableArray array];
    }
    return self;
}

- (void)setValue:(id)value forKey:(NSString *)key{
    [super setValue:value forKey:key];

    if ([key isEqualToString:@"elements"]) {

        NSArray *dataSoruceArray = value;
//        //处理轮播数据
//        NSDictionary*tempLBDic = dataSoruceArray.firstObject;
//        NSArray *tempFistArray = tempLBDic[@"data"];
//        self.LbDataArray = [NSMutableArray array];
//        for (NSDictionary *dic in tempFistArray.firstObject) {
//            WHTFirstPageLBModel *model = [[WHTFirstPageLBModel alloc] init];
//            [model setValuesForKeysWithDictionary:dic];
//            [self.LbDataArray addObject:model];
//        }
        
//

    
        for (NSDictionary *tempDic in dataSoruceArray) {
                //处理第一个分区,每日精选故事model
            if ([tempDic[@"type"] integerValue] == 10) {
                NSArray *tempArray = tempDic[@"data"];
                WHTFirstPageStoryModel  *model = [[WHTFirstPageStoryModel alloc] init];
                [model setValuesForKeysWithDictionary:tempArray.firstObject];
                [self.storyDataArray addObject:model];
            }
            
         //处理第二个分区,热门游记数据
            if ([tempDic[@"desc"] isEqualToString:@"热门游记"]) {
                NSArray *tempArray = tempDic[@"data"];
                WHTFirstPageTripModel *model = [[WHTFirstPageTripModel alloc] init];
                [model setValuesForKeysWithDictionary:tempArray.firstObject];
                [self.tripDataArray addObject:model];
            }
        }
        
    }
    
    
}


@end
